package com.application.lucky.activity.me;

import android.os.Bundle;
import android.view.View;

import com.application.lucky.R;
import com.application.lucky.request.CallBackEx;
import com.application.lucky.request.UserRequest;
import com.application.lucky.utils.Flog;
import com.application.lucky.widget.TitlebarView;
import com.application.lucky.widget.popupwindow.BaoBiaoTimePop;
import com.application.mylibrary.base.BaseActivity;
import com.baselib.libnetwork.net.libnetworkcomponent.BaseResponse;

import java.util.Date;

public class MyPlayerActivity extends BaseActivity implements View.OnClickListener {
    private BaoBiaoTimePop baoBiaoTimePop;

    private TitlebarView mTitleBar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        initView();
    }

    @Override
    public void beforeInit() {

    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_my_player;
    }

    private void initView() {
        mTitleBar = findViewById(R.id.title_bar);
        mTitleBar.setOnViewClick(new TitlebarView.onViewClick() {
            @Override
            public void leftClick() {
                finishAnim();
            }

            @Override
            public void rightClick() {
                if (baoBiaoTimePop == null) {
                    baoBiaoTimePop = new BaoBiaoTimePop(MyPlayerActivity.this, new BaoBiaoTimePop.TimeSelectListener() {
                        @Override
                        public void selectTime(long time, long endTime) {
                            loadPlayer(time, endTime);
                        }
                    });
                }
                baoBiaoTimePop.show(mTitleBar);
            }
        });

        loadPlayer(1, new Date().getTime());
    }

    private void loadPlayer(long time, long endTime) {
        new UserRequest().relation_partner_list(new CallBackEx<BaseResponse>() {
            @Override
            public void onFailed(int code) {

            }

            @Override
            public void onSuccess(BaseResponse baseResponse) {
                Flog.d(TAG, "loadPlayer:" + baseResponse.dataInfo);
            }
        });
    }

    @Override
    public void onClick(View view) {
    }
}
